#/usr/bin/python
'''
Created on Jul 27, 2011

@author: vijayp
'''
import argparse
from qif import qif, AperioCSVImporter, GetTickerToNameMap
parser = argparse.ArgumentParser(description='convert aperio csv to qif')
parser.add_argument('--account_name', type=str,
                      help='the account name, exactly as it appears in quicken',
                      required=True)
parser.add_argument('--account_type', type=str,
                      help="the account type. currently supprted are: 'Bank', 'CCard', 'Invst'",
                      required=True)
parser.add_argument('--file', type=str,
                      help="csv filename", required=True)

parser.add_argument('--input_file', type=str,
                      help="input file with stock info for merging", required=True)


if __name__ == '__main__':

  args = parser.parse_args()
  q = qif(args.account_name, args.account_type)
  ttn = GetTickerToNameMap(args.input_file)
  AperioCSVImporter.import_to_qif(args.file, q, ttn)
  q.set_header('Security')
  print q.str()

